package jmine.tec.aom.export;

import java.util.ArrayList;
import java.util.List;

import jmine.tec.aom.dao.PropertyDAO;
import jmine.tec.aom.domain.PropertyGroup;
import jmine.tec.aom.services.include.PropertyGroupService;
import jmine.tec.services.api.export.AbstractServiceFillerEntityExporter;
import jmine.tec.services.api.export.DefaultExportAction;

/**
 * Defines a {@link jmine.tec.services.api.export.ServiceFiller} based export strategy for {@link PropertyGroup}.
 * 
 * @author jrenaut
 */
public class PropertyGroupExporter extends AbstractServiceFillerEntityExporter<PropertyGroup> {

    private PropertyDAO propertyDAO;

    /**
     */
    public PropertyGroupExporter() {
        super(new PropertyGroupService(), DefaultExportAction.INCLUIR);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<Object> exportAfter(PropertyGroup entity) {
        List<Object> after = new ArrayList<Object>(super.exportAfter(entity));
        after.addAll(this.propertyDAO.findByGroupOrderedByPk(entity));
        return after;
    }

    /**
     * @param propertyDAO the propertyDAO to set
     */
    public void setPropertyDAO(PropertyDAO propertyDAO) {
        this.propertyDAO = propertyDAO;
    }

}
